package com.zhangsr.zus.remoting.api;

import com.zhangsr.zus.common.URL;
import com.zhangsr.zus.remoting.api.exception.RemotingException;

/**
 * @Author: zhangsr
 */
public interface Transporter {

    /**
     * Bind a server.
     *
     * @param url     server url
     * @param handler
     * @return server
     * @throws RemotingException
     */
    Server bind(URL url, ChannelHandler handler) throws RemotingException;

    /**
     * Connect to a server.
     *
     * @param url     server url
     * @param handler
     * @return client
     * @throws RemotingException
     */
    Client connect(URL url, ChannelHandler handler) throws RemotingException;
}
